FROM registry.cn-hangzhou.aliyuncs.com/whlike/centos:centos7.7.1908

COPY ./data-integration /data-integration
RUN mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
COPY ./CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo
RUN yum install -y java

ENV CARTE_USERNAME=${CARTE_USERNAME}
ENV CARTE_PASSWORD=${CARTE_PASSWORD}
ENV CARTE_NAME=${CARTE_NAME}
ENV CARTE_HOSTNAME=0.0.0.0
ENV CARTE_PORT=8080
ENV CARTE_MASTER=${CARTE_MASTER}

RUN sed -i "s/\${CARTE_USERNAME}/$CARTE_USERNAME/g;s/\${CARTE_PASSWORD}/$CARTE_PASSWORD/g;s/\${CARTE_NAME}/$CARTE_NAME/g;s/\${CARTE_HOSTNAME}/$CARTE_HOSTNAME/g;s/\${CARTE_PORT}/$CARTE_PORT/g;s/\${CARTE_MASTER}/$CARTE_MASTER/g" /data-integration/pwd/carte-config-master-8080.xml

CMD /data-integration/carte.sh /data-integration/pwd/carte-config-master-8080.xml
EXPOSE 8080/tcp